package com.itheima.provider.controller;

import com.itheima.provider.domain.Goods;
import com.itheima.provider.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/goods")
@RefreshScope

public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    @Value("${name}")
    private String name;

    @GetMapping("findId/{id}")
    public Goods findId(@PathVariable("id") int id){
        Goods goods = goodsService.findId(id);
        goods.setTitle("从服务提供者8081给出,原创name为"+name);
       return goods;
    }








}
